CREATE TABLE jms_dm.dm_sq_registration_problem_count_dt 
(
    select_type tinyint(4) NULL COMMENT "查询类型（1接受网点 2 登记网点类型",
    is_repeat tinyint(4) NULL COMMENT "是否重复（1不重复2重复）",
    in_out_bound int(11) NULL COMMENT "进出港类型",
    order_source_name varchar(120) NULL COMMENT "订单来源名称",
    agent_code varchar(50) NULL COMMENT "所属代理区code",
    network_code varchar(50) NULL COMMENT "网点编码",
    order_source_code varchar(50) NULL COMMENT "订单来源编码",
    network_name varchar(120) NULL COMMENT "名称",
    agent_name varchar(120) NULL COMMENT "所属代理区",
    proble_type_name varchar(120) NULL COMMENT "操作类型名称 eg派件、分拨",
    proble_type_id varchar(50) NULL COMMENT "操作类型编码 eg4,2",
    create_date date NULL COMMENT "登记日期 yyyMMdd",
    second_level_type_code varchar(50) NULL COMMENT "问题件二级类型编码 eg66a",
    second_level_type_name varchar(120) NULL COMMENT "问题件二级类型名称",
    proble_type_subject_code varchar(50) NULL COMMENT "问题件一级类型编码 eg66",
    proble_type_subject_name varchar(120) NULL COMMENT "问题件一级类型名称",
    proble_cnt int(11) NULL COMMENT "当日问题件量",
    last_proble_cnt int(11) NULL COMMENT "上一日问题件量",
    oper_cnt int(11) NULL COMMENT "操作量目前只有中心有，统计维度中心 日期 订来来源对应需求2报表",
    network_type tinyint(4) NULL COMMENT "网点类型:1-总部,2-代理区,3-加盟商,4-中心,5-集散点,6-网点",
    date_time date NULL COMMENT "查询时间"
) ENGINE=OLAP 
DUPLICATE KEY(select_type, is_repeat, in_out_bound,order_source_name)
COMMENT "服务质量-问题件看板汇总"
PARTITION BY RANGE (date_time) ( 
   START ("2022-12-01") END ("2023-01-10") EVERY (INTERVAL 1 day))
DISTRIBUTED BY HASH(network_code) BUCKETS 4
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-180",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "4",
"in_memory" = "false",
"storage_format" = "V2"
);

alter table jms_dm.dm_sq_registration_problem_count_dt add column (
  manage_code varchar(50) comment '大区code',
  manage_name varchar(100) comment'大区name',
  fran_code varchar(50) comment'加盟商code',
  fran_name varchar(100) comment'加盟商name'
);

alter table jms_dm.dm_sq_registration_problem_count_dt add column(
  network_id varchar(50) comment'网点id'
);